package com.example.demo.controller;

import com.example.demo.entity.SqlInfo;
import com.example.demo.response.Request;
import com.example.demo.service.BmDatasourceManagementService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author suliwei
 * @description
 * @date 2025/5/26 15:00
 */
@Slf4j
@RestController
@RequestMapping(value = "/bmDatasourceManagement")
public class BmDatasourceManagementController {

    @Resource
    private BmDatasourceManagementService bmDatasourceManagementService;

    @RequestMapping(value = "/queryByPage")
    public Request queryByPage(@RequestBody SqlInfo sqlInfo) {
        return this.bmDatasourceManagementService.getDataBySql(sqlInfo);
    }

    @RequestMapping(value = "/test", produces = MediaType.APPLICATION_JSON_VALUE)
    public Request test(@RequestBody SqlInfo sqlInfo) {
        return Request.success( "success");
    }

}
